package com.rc.saas.tenant.service.elec;


import com.github.pagehelper.PageInfo;
import com.rc.saas.tenant.base.BaseSearch;
import com.rc.saas.tenant.base.BaseService;
import com.rc.saas.tenant.mapper.elec.ElecStationMapper;
import com.rc.saas.tenant.model.area.PlatformProvince;
import com.rc.saas.tenant.model.elec.ElecStation;
import com.rc.saas.tenant.model.elec.ElecStationExample;
import com.rc.saas.tenant.model.hlht.HlhtTenantOpen;
import com.rc.saas.tenant.model.tenant.Tenant;
import com.rc.saas.tenant.search.StatisticsSearch;
import com.rc.saas.tenant.search.elec.ElecSationSearch;
import com.rc.saas.tenant.search.hlht.HlhtTenantOpenStationSearch;
import com.rc.saas.tenant.search.elec.StationHlhtTenantOpenSearch;
import com.rc.saas.tenant.vo.elec.*;
import com.rc.saas.tenant.vo.hlht.HlhtTenantOpenStationExportVo;
import com.rc.saas.tenant.vo.hlht.HlhtTenantOpenStationVo;
import com.rc.saas.tenant.vo.hlht.StationHlhtTenantOpenVo;
import com.rc.saas.tenant.vo.invoice.InvoiceProxyStationSearchVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * Created by sven on 2018-04-17
 */
public interface ElecStationService extends BaseService<Long, ElecStation, ElecStationExample, ElecStationMapper> {
    void insertSelectiveReturnId(ElecStation elecStation);

    /**
     * 查询桩群和城市地区名称
     */
    ElecStationAndCityName selectStationAndCity(Long elecStationId);

    void updateStatus(Long elecStationId);

    void deleteStationAndPileGun(Long elecStationId);

    List<ElecStation> listStationBySelf(String tenantCode);

    String generateStationNo(Tenant tenant);

    String selectMostProvinceId(String tenantCode);

    PlatformProvince selectAllAreaByProvinceId(String provinceId);

    List<ElecStation> listPrintStation(ElecSationSearch elecSationSearch);

    /**
     * 查询站点总览的统计数据
     * @param tenantCode
     * @return
     */
    StationAllDataVo selectStationAllData(String tenantCode);

    List<ElecStation> listStationAndLatiLong(String tenantCode, BaseSearch baseSearch);
    /**
     * 查询站点总览的统计数据(场地方)
     * @param tenantOperatorCode..
     * @return
     */
    StationAllDataVo selectStationAllDataOperator(String tenantOperatorCode);

    List<ElecStation> selectStationAndLatiLongOperator(String tenantOperatorCode);

    PageInfo<ElecStationResult> listPageByCondition(ElecSationSearch elecSationSearchVo);

    /**QQ
     * 指定运营商的所有桩群(不包括互联互通/分销商)
     * @param tenantCode
     * @return
     */
    List<ElecStation> listAllStationByTenantCode(String tenantCode);

    /**
     * 指定分销商的所有桩群
     * @param tenantOperatorCode
     * @return
     */
    List<ElecStation> listAllStationByTenantOperatorCode(String tenantOperatorCode);

    /*
    传ticketTypeId为回显互联互通桩群
     */
    List<ElecStation> listAllStationAndHlht(String tenantCode,Long ticketTypeId);

    Map<String, List<ElecStation>> listTicketStationHlht(String tenantCode, Long ticketTypeId);


    /**
     * 正向桩群信息
     */
    List<ElecStation> listByHlhtOperator(String tenantCode, String hlhtTenantCode);

    /**
     * 正向互联时，根据第三方运营商ID和第三方桩群编号查找（唯一）
     */
    ElecStation selectHlhtByOperatorAndStationNo(String tenantCode, String hlhtOperatorId, String hlhtStationNo);

    /**
     * 内部
     */
    PageInfo<StationHlhtTenantOpenVo> listPageStationHlhtTenantOpenInternal(StationHlhtTenantOpenSearch stationHlhtTenantOpenSearch);

    PageInfo<StationHlhtTenantOpenVo> listPageStationHlhtTenantOpenExternal(StationHlhtTenantOpenSearch stationHlhtTenantOpenSearch);

    PageInfo<HlhtTenantOpenStationVo> listPageHlhtOpenStation(HlhtTenantOpenStationSearch hlhtTenantOpenStationSearch);

    PageInfo<ElecStation> listPageParkingGateStation(Integer offset, Integer limit,
                                            String tenantCode, Long parkingSupplierId, String status);

    List<ElecStation> listElecStationNonconnectGate(String tenantCode);

    List<ElecStation> listByBatch(List<Long> elecStationIdList);

    List<ElecStation> listElecStationByStationName(String tenantCode, String stationName);

    PageInfo<ElecStationResult> listPageOperatorElecStaion(ElecSationSearch elecSationSearchVo);

    /**
     * 正向互联，查询正向互联的站点列表
     */
    PageInfo<HlhtTenantOpenStationVo> listPageHlhtStation(HlhtTenantOpenStationSearch hlhtTenantOpenStationSearch);

    /**
     * 正向互联关系站点信息
     */
    ElecStationAndCityName selectPositiveHlhtStationAndCity(Long elecStationId);

    /**
     * 正向关系中的站点批量上下线
     */
    void updateBatchPositiveHlhtStation(List<Long> elecStationIdList,String operateStatus);

    List<HlhtTenantOpenStationExportVo> listHlhtTenantOpenStation(HlhtTenantOpenStationSearch hlhtTenantOpenStationSearch);




    PageInfo<ElecStation> listPageInvoiceProxyStation(InvoiceProxyStationSearchVo invoiceProxyStationSearchVO);

    Map<String, List<ElecStation>> listTicketStationExternalHlht(String tenantCode, Long ticketTypeId);

    /**
     * 根据互联关系，更新运营状态
     * @param hlhtTenantOpen
     * @param operatorStatus
     */
    void updateOperateStatusByHlhtTenantOpen(HlhtTenantOpen hlhtTenantOpen, String operatorStatus);

    void updateForNoTop(Long elecStationId);

    ElecStation selectLaststationNo();

    /**
     * 更改安全防护状态
     * @param batteryStationIdList
     * @param socStationIdList
     * @param chargeLimitSoc
     * @param chargeLimitBatteryTemp
     */
    void updateSecurityStationList(List<SecurityPrevention> batteryStationIdList, List<SecurityPrevention> socStationIdList, String chargeLimitSoc, String chargeLimitBatteryTemp,String tenantCode);

    int countStation(StatisticsSearch search);

    StatisticsStationNum getStatisticsStationNum(ElecSationSearch search);
}
